"use strict";
cc._RF.push(module, '4f837LWDStAZb8KbaghAHEX', 'DataMgr');
// scripts/DataMgr.js

"use strict";

var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
  value: !0
});
n.GlobalEvent = void 0;
var o = cc._decorator.ccclass;
n.GlobalEvent = new cc.EventTarget();

var i = function () {
  function e() {
    this.curLevel = 0;
    this.maxSkin = 9;
    this.maxLevelNum = 15;
    this.isAdOn = !1;
  }

  t = e;
  Object.defineProperty(e, "Instance", {
    get: function get() {
      if (null == t.instance) {
        t.instance = new t();
        t.instance.init();
      }

      return t.instance;
    },
    enumerable: !1,
    configurable: !0
  });
  Object.defineProperty(e.prototype, "closeDelayTime", {
    get: function get() {
      return SDK.Mgr.Inst.curChannel == SDK.Define.Channel.oppo ? SDK.Mgr.Inst.isAdOpen ? 2 : 0 : SDK.Mgr.Inst.curChannel == SDK.Define.Channel.vivo ? 0 : SDK.Mgr.Inst.curChannel == SDK.Define.Channel.tt ? 2.5 : SDK.Mgr.Inst.curChannel == SDK.Define.Channel.qq ? SDK.Mgr.Inst.isAdOpen ? 2 : 0 : SDK.Mgr.Inst.curChannel == SDK.Define.Channel.wx ? SDK.Mgr.Inst.isAdOpen ? 2 : 0 : 2.5;
    },
    enumerable: !1,
    configurable: !0
  });
  Object.defineProperty(e.prototype, "coinNum", {
    get: function get() {
      cc.sys.localStorage.getItem("coinNum") || cc.sys.localStorage.setItem("coinNum", 100);
      return parseFloat(cc.sys.localStorage.getItem("coinNum"));
    },
    set: function set(e) {
      n.GlobalEvent.emit("CoinChange", this.coinNum, e, !0);
      cc.sys.localStorage.setItem("coinNum", e);
    },
    enumerable: !1,
    configurable: !0
  });
  Object.defineProperty(e.prototype, "videoAdTimes", {
    get: function get() {
      cc.sys.localStorage.getItem("videoAdTimes") || cc.sys.localStorage.setItem("videoAdTimes", 0);
      return parseFloat(cc.sys.localStorage.getItem("videoAdTimes"));
    },
    set: function set(e) {
      cc.sys.localStorage.setItem("videoAdTimes", e);
    },
    enumerable: !1,
    configurable: !0
  });
  Object.defineProperty(e.prototype, "curSkinNum", {
    get: function get() {
      cc.sys.localStorage.getItem("skinNum") || cc.sys.localStorage.setItem("skinNum", 0);
      var e = parseInt(cc.sys.localStorage.getItem("skinNum"));
      e < 0 ? e = 0 : e > this.maxSkin - 1 && (e = this.maxSkin - 1);
      return e;
    },
    set: function set(e) {
      cc.sys.localStorage.setItem("skinNum", e);
      n.GlobalEvent.emit("SkinChange");
    },
    enumerable: !1,
    configurable: !0
  });

  e.prototype.hasSkin = function (e) {
    return 0 == e || "true" == cc.sys.localStorage.getItem("UnlockSkin_" + e);
  };

  e.prototype.setSkin = function (e, t) {
    t && SDK.Mgr.Inst.event("UnlockSkin_" + (e + 1));
    cc.sys.localStorage.setItem("UnlockSkin_" + e, t ? "true" : "false");
  };

  Object.defineProperty(e.prototype, "audioVolume", {
    get: function get() {
      cc.sys.localStorage.getItem("audioVolume") || "0" == cc.sys.localStorage.getItem("audioVolume") || cc.sys.localStorage.setItem("audioVolume", 1);
      return parseInt(cc.sys.localStorage.getItem("audioVolume"));
    },
    set: function set(e) {
      cc.sys.localStorage.setItem("audioVolume", e);
      this.updateAudioVolume();
    },
    enumerable: !1,
    configurable: !0
  });

  e.prototype.updateAudioVolume = function () {
    var e = this.audioVolume;
    console.log("audioVolume", this.audioVolume);
    cc.audioEngine.setMusicVolume(e);
    cc.audioEngine.setEffectsVolume(e);
  };

  e.prototype.setUp = function () {};

  e.prototype.init = function () {
    this.updateAudioVolume();
  };

  var t;
  e.instance = void 0;
  e.isRestart = !1;
  return t = __decorate([o], e);
}();

n["default"] = i;

cc._RF.pop();